1 00:00:00,540 --> 00:00:04,730 Hello and welcome to this leg show on bounce and the ball. 2 00:00:04,890 --> 00:00:08,300 This will be a two part lecture. 3 00:00:08,550 --> 00:00:16,470 The part one will be refined in the corenda called What We Going To Do we are going to create another 4 00:00:16,470 --> 00:00:23,580 function and split the methods from the previous function. 5 00:00:23,700 --> 00:00:24,680 So let's do that. 6 00:00:24,680 --> 00:00:31,260 There currently we have just the one formation which is the drug function. 7 00:00:31,470 --> 00:00:32,580 But what will it do. 8 00:00:32,580 --> 00:00:41,580 I'm going to create another function called the draw ball function that will be responsible for drawing 9 00:00:41,610 --> 00:00:43,050 the ball on the canvas. 10 00:00:43,200 --> 00:00:49,350 So I'm gonna move a lot of these some of these methods in here into that robot function. 11 00:00:49,380 --> 00:00:56,970 And I will move the Claire rect method in to up into the drawer. 12 00:00:56,970 --> 00:01:07,130 I leave that in the drawer function so let me start by creating the first the job of functions I'll 13 00:01:07,320 --> 00:01:13,390 do that by defining the function. 14 00:01:13,800 --> 00:01:18,350 And then fill a bad name and when to call a drop ball. 15 00:01:20,720 --> 00:01:28,830 When creating a functions it's always a good idea to make the names relevant to what the function is 16 00:01:28,830 --> 00:01:30,980 meant to do. 17 00:01:31,170 --> 00:01:37,420 Still the parent this is there an in-between the parenthesis. 18 00:01:37,700 --> 00:01:44,520 You have your queally braithwaite's inside the curly braces is where you specify what the function is 19 00:01:44,520 --> 00:01:50,140 going to do so this function of called it draw ball. 20 00:01:51,480 --> 00:01:58,260 Okay so what women are going to move some of this methods from here. 21 00:01:58,410 --> 00:02:04,840 Then start from the begin part right up to the close part. 22 00:02:04,860 --> 00:02:14,870 I'm going to move or I'm just going to cut and paste okay for move in there. 23 00:02:14,870 --> 00:02:17,910 I mean bring that to tided out of Pipit. 24 00:02:18,870 --> 00:02:24,220 Okay for my curly braces match up everything is okay then. 25 00:02:25,140 --> 00:02:30,650 Okay so I've created a new fonteyn here draw ball and this is the old function. 26 00:02:30,780 --> 00:02:36,580 But what I need to do I need to make a reference to the drob Ball function here. 27 00:02:36,610 --> 00:02:43,140 Slave can be referenced from this draw from chance or just on the needs of tidy clairette. 28 00:02:43,380 --> 00:02:44,990 I need to insert. 29 00:02:45,120 --> 00:02:51,810 We need to call the draw board function so to do that. 30 00:02:51,840 --> 00:02:59,410 Good Grobe ball. 31 00:03:00,060 --> 00:03:00,710 Okay. 32 00:03:03,480 --> 00:03:11,320 So this function here the drobo will also be called from this draw function. 33 00:03:11,990 --> 00:03:13,050 I am happy with that. 34 00:03:13,050 --> 00:03:21,360 I just click on save and is good to my index and run nothing should change in terms of how the cumbersome 35 00:03:21,360 --> 00:03:26,600 behaves because all I've done is create created an extra function. 36 00:03:26,620 --> 00:03:32,750 Move the methods around so let's see what the cover looks like it should be the same. 37 00:03:34,550 --> 00:03:39,140 Okay so the same to so nicely fully stop the ball leaving the compass. 38 00:03:39,130 --> 00:03:42,820 Here we're going to do that in the next lecture. 39 00:03:43,220 --> 00:03:44,860 Thank you so much for watching. 40 00:03:45,020 --> 00:03:45,710 Bye for now. 41 00:03:45,710 --> 00:03:48,700 Please let me know if you have any questions.